package com.duoduo.demo.springnoxml.vo;

import org.springframework.beans.BeanUtils;

import com.duoduo.demo.springnoxml.model.HelpTopic;

/**
 * 帮助主题Entity
 * @author chengesheng@kedacom.com
 * @date 2017年10月23日下午3:14:16
 */
public class HelpTopicVO {

	/** 分类ID */
	private int id;
	/** 帮助名称 */
	private String name;
	/** 所属分类 */
	private int categoryId;
	/** 描述 */
	private String description;
	/** 示例 */
	private String example;
	/** 链接地址 */
	private String url;

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getCategoryId() {
		return categoryId;
	}

	public void setCategoryId(int categoryId) {
		this.categoryId = categoryId;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getExample() {
		return example;
	}

	public void setExample(String example) {
		this.example = example;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	/**
	 * Entity 转换为 VO
	 * @param entity
	 * @return
	 */
	public static HelpTopicVO fromEntity(HelpTopic entity) {
		HelpTopicVO vo = new HelpTopicVO();
		BeanUtils.copyProperties(entity, vo);
		return vo;
	}

	/**
	 * VO 转换为 Entity
	 * @param entity
	 * @return
	 */
	public static HelpTopic toEntity(HelpTopicVO vo) {
		HelpTopic entity = new HelpTopic();
		BeanUtils.copyProperties(vo, entity);
		return entity;
	}

}
